<?php
$archives = new archives();
include_once $config ['client_theme_path'].$config ['client_theme'].'/header.php'; ?>
<?php
    $articles = $archives->getArticles();
    if($config['page']>1) {
        $config['site_title'] = 'Trang '.$config['page']. ' - ' . 'Tháng '.$params[1].' năm '.$params[0].' - '. $config['site_title'];
        $config['site_description'] = 'Trang '.$config['page']. ' - ' . 'Tháng '.$params[1].' năm '.$params[0].' - '. $config['site_description'];
        $config['site_keyword'] = 'Trang '.$config['page']. ' - ' . 'Tháng '.$params[1].' năm '.$params[0].', '. $config['site_keyword'];
    }else {
        $config['site_title'] = 'Tháng '.$params[1].' năm '.$params[0].' - '. $config['site_title'];
        $config['site_description'] = 'Tháng '.$params[1].' năm '.$params[0].' - '. $config['site_description'];
        $config['site_keyword'] = 'Tháng '.$params[1].' năm '.$params[0].', '. $config['site_keyword'];
    }
?>
<div id="container">
    	<div class="cat-details">
            <ul class="listcate">
                <?php
                    $i=0;
                    while($rs=$db->fetch_array($articles['rsArticles'])) {
                        $i++;
                        if($i==1){

                 ?>
                    <li class="top">
                        <a href="/<?php echo $rs['link'];?>.html" title="<?php echo viewTitleLink($rs['title']);?>"><img src="<?php echo createThumb($rs['image']);?>" title="<?php echo viewTitleLink($rs['title']);?>" alt="<?php echo viewTitleLink($rs['title']);?>" class="thumb" /></a>
                        <h2><a href="/<?php echo $rs['link'];?>.html" title="<?php echo viewTitleLink($rs['title']);?>"><?php echo $rs['title'];?></a></h2>
                        <font class="date"><?php echo date('d/m/Y H:i',strtotime($rs['create_date']));?></font>
                        <p><?php echo $rs['short_description'];?></p>
                    </li>
                 <?php
                        }else{
                    ?>
                    <li>
                        <a href="/<?php echo $rs['link'];?>.html" title="<?php echo viewTitleLink($rs['title']);?>"><img src="<?php echo createThumb($rs['image']);?>" title="<?php echo viewTitleLink($rs['title']);?>" alt="<?php echo viewTitleLink($rs['title']);?>" class="thumb" /></a>
                        <h2><a href="/<?php echo $rs['link'];?>.html" title="<?php echo viewTitleLink($rs['title']);?>"><?php echo $rs['title'];?></a></h2>
                        <font class="date"><?php echo date('d/m/Y H:i',strtotime($rs['create_date']));?></font>
                        <p><?php echo $rs['short_description'];?></p>
                    </li>
                    <?php
                        }
                    ?>
                        <?php
                        $lastDate = $rs['create_date'];
                    }
                ?>



            </ul>
            <div class="panaging">
            	<ul class="panation">
                        <?php
                        $totalRows =  $articles['totalRows'];
                        $totalPages = ceil($totalRows/$config ['total_article_on_category']);
                        echo paging($config ['page'],$totalPages);
                        ?>
                </ul>
            </div>

            <div class="bg-tab-3 margin2">
            	<ul class="tab-1">
                    <li class="current"><a href="#nogo"><b style="font-size:12px; font-weight:bold;">Các tin khác</b></a></li>
                </ul>
            </div>
            <ul class="othernews">
                <?php
                $rsOther = $archives->ortherOlderArticle($lastDate,10);
                while($rs=$db->fetch_array($rsOther)) {
                    ?>
                <li>
                    <span class="left"><?php echo date('d/m/Y',strtotime($rs['create_date']));?></span>
                    <span class="right"><a href="/<?php echo $rs['link'];?>.html" title="<?php echo viewTitleLink($rs['title']);?>"><?php echo $rs['title'];?></a></span>
                </li>
                <?php
                }
                ?>
            </ul>
        </div>
        <?php  include_once $config ['client_modules_path'].'/common_right.php'; ?>
    </div>
<?php include_once $config ['client_theme_path'].$config ['client_theme'].'/footer.php'; ?>